package gov.pbc.nn.kjgl.gzjh.dao;

import gov.pbc.nn.core.bdf.IUserSelect;
import gov.pbc.nn.core.bdf.entity.Dept;
import gov.pbc.nn.core.utils.SecurityUtils;
import gov.pbc.nn.kjgl.Constants;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.bstek.bdf2.core.business.IUser;
import com.bstek.bdf2.core.context.ContextHolder;
import com.bstek.dorado.data.provider.Criteria;
import com.bstek.dorado.data.provider.Page;

/**
 * 工作计划的科长下拉列表
 * @author jack.zhao
 *
 */
@Component("selectKzDao")
public class SelectKzDao implements IUserSelect {
	@Override
	public void loadUsers(Page<IUser> page, Criteria criteria, Map<String, Object> params) throws Exception {
//		List<IUser> users = SecurityUtils.getUserByRoleForDeptWithChildren(dept.getCDept().getId(), Constants.ROLE_KZ);
		Dept dept = (Dept) ContextHolder.getLoginUser().getDepts().get(0);
		List<IUser> userList = SecurityUtils.getUserByRoleForDeptWithChildren(dept.getCDept().getId(), Constants.ROLE_KZ);
		page.setEntities(userList);
		page.setEntityCount(userList.size());
	}
}
